﻿using LDM.Sys.ServiceAPI.Model.DBModel;
using Model.Models;

namespace LDM.Admin.Models.Base
{
    public class BaseGrid<T> where T : class
    {
        public int total { get; set; }

        public List<T> rows { get; set; }

        public static BaseGrid<T> Instance(List<T> rows, int total)
        {
            return new BaseGrid<T>
            {
                total = total,
                rows = rows
            };
        }

        public static BaseGrid<T> Instance(PageResult<T> pageResult)
        {
            return new BaseGrid<T>
            {
                total = pageResult.Total,
                rows = pageResult.Data
            };
        }
    }
}
